
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%--使用taglib 引入标签库--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>班级列表</title>
    <link rel="stylesheet" href="<c:url value="/css/pintuer.css"/>">
    <link rel="stylesheet" href="<c:url value="/css/user.css"/>">
    <script src="<c:url value="/js/jquery.js"/>"></script>
    <script src="<c:url value="/js/pintuer.js"/>"></script>
</head>
<body>
<form method="post" action="" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 学生信息列表</strong>
        </div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li><a class="button border-main icon-plus-square-o" href="?action=input"> 添加</a></li>
                <li>搜索：</li>
                <li>
                    <input type="text" placeholder="请输入搜索关键字" id="keywords" name="keywords" class="input"
                           style="width:250px; line-height:17px;display:inline-block"/>
                    <a class="button border-main icon-search"
                       onclick="location.href='?action=search&keywords=' + encodeURIComponent(document.getElementById('keywords').value)">搜索</a>
                </li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th style="width: 100px">ID</th>
                <th>学号</th>
                <th>班级编号</th>
                <th>密码</th>
                <th>姓名</th>
                <th>性别</th>
                <th>住址</th>
                <th>电话号码</th>
                <th>联系人</th>
                <th>联系人电话</th>
                <th>操作</th>
            </tr>
            <%--使用JSTL迭代标签输出用户信息(User)列表list--%>
            <c:forEach var="m" items="${list}" varStatus="i">
                <tr>
                    <td width="100">${i.count}</td>
                    <td>${m.stuID}</td>
                    <td>${m.classID}</td>
                    <td>${m.password}</td>
                    <td>${m.stuName}</td>
                    <td>${m.sex}</td>
                    <td>${m.address}</td>
                    <td>${m.stuTel}</td>
                    <td>${m.contact}</td>
                    <td>${m.contactTel}</td>
                    <td>
                        <div class="button-group">
                            <a class="button border-main" href="?action=get&stuID=${m.stuID}"><span
                                    class="icon-edit"></span> 修改</a>
                            <a class="button border-red" href="?action=delete&stuID=${m.stuID}"
                            ><span class="icon-trash-o"></span> 删除</a>
                        </div>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <div class="pagelist"><a href="">上一页</a> <span class="current">1</span><a href="">2</a><a
                href="">3</a><a href="">下一页</a><a href="">尾页</a></div>
    </div>
</form>
<script type="text/javascript">
    window.onload = function () {
        // 使用 JSTL 判断并插入操作结果
        <c:if test="${operation == 'success'}">
        alert("操作成功！");
        </c:if>
        <c:if test="${operation == 'failure'}">
        alert("操作失败，错误信息：${message}");
        </c:if>
    };
</script>
</body>
</html>
